FROM ubuntu:22.04

ARG VERSION_ARG="1.0"
ARG VERSION_VNC="1.5.0"

ARG DEBCONF_NOWARNINGS="yes"
ARG DEBIAN_FRONTEND="noninteractive"
ARG DEBCONF_NONINTERACTIVE_SEEN="true"

# 更换镜像源加速apt-get
RUN set -eu && \
    sed -i 's@/archive.ubuntu.com/@/mirrors.aliyun.com/@g' /etc/apt/sources.list && \
    apt-get clean && \
    apt-get update && \
    apt-get --no-install-recommends -y install \
        binutils \
        binutils-dev \
        git git-lfs \
        gnupg \
        flex bison \
        gperf \
        build-essential \
        zip \
        curl \
        python3-pip \
        zlib1g-dev \
        gcc-multilib \
        g++-multilib \
        lib32ncurses5-dev \
        x11proto-core-dev \
        libx11-dev \
        lib32z1-dev \
        ccache \
        libgl1-mesa-dev \
        libxml2-utils \
        xsltproc \
        unzip \
        m4 \
        bc \
        gnutls-bin \
        ruby \
        genext2fs \
        device-tree-compiler \
        libffi-dev \
        e2fsprogs \
        pkg-config \
        perl \
        openssl \
        libssl-dev \
        libelf-dev \
        libdwarf-dev \
        u-boot-tools \
        mtd-utils \
        cpio \
        doxygen \
        liblz4-tool \
        texinfo \
        dosfstools \
        mtools \
        default-jre \
        default-jdk \
        libncurses5 \
        apt-utils \
        scons \
        rsync \
        libxml2-dev \
        lib32z-dev \
        grsync \
        vim \
        libglib2.0-dev \
        libpixman-1-dev \
        kmod \
        jfsutils \
        reiserfsprogs \
        xfsprogs \
        squashfs-tools \
        pcmciautils \
        quota \
        ppp \
        libtinfo-dev \
        libtinfo5 \
        libncurses5-dev \
        libncursesw5 \
        libstdc++6 \
        gcc-arm-none-eabi \
        ssh \
        locales \
        libxinerama-dev \
        libxcursor-dev \
        libxrandr-dev \
        libxi-dev \
        cpu-checker \
        bridge-utils \
        qemu-kvm \
        qemu-system-x86 \
        qemu-system-arm \
        qemu-system-aarch64 \
        qemu-system-mips \
        qemu-system-ppc \
        qemu-system-s390x \
        libvirt-daemon-system \
        libvirt-clients \
        libfdt-dev \
        tini \
        wget \
        7zip \
        ovmf \
        swtpm \
        procps \
        iptables \
        iproute2 \
        apt-utils \
        dnsmasq \
        xz-utils \
        net-tools \
        qemu-utils \
        genisoimage \
        ca-certificates \
        netcat-openbsd && \
    apt-get clean && \
    echo "$VERSION_ARG" > /run/version && \
    rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

COPY --chmod=755 ./src /run/

VOLUME /storage
EXPOSE 22 5900

ENTRYPOINT ["/usr/bin/tini", "-s", "/run/entry.sh"]
